//
//  SelectedCell.m
//  相片相机
//
//  Created by ZJF on 16/6/3.
//  Copyright © 2016年 ZJF. All rights reserved.
//

#import "SelectedCell.h"
#import "SDBallProgressView.h"
#import "Masonry.h"
@implementation SelectedCell

-(instancetype)initWithFrame:(CGRect)frame{

    if (self == [super initWithFrame:frame]) {
        [self createUI];
    }
    
    return self;

}
- (NSMutableArray *)demoViews
{
    if (_demoViews == nil) {
        _demoViews = [NSMutableArray array];
    }
    return _demoViews;
}

-(void)addProgressFrame{
    [self.demoViews addObject:[SDDemoItemView demoItemViewWithClass:[SDBallProgressView class]]];
    [self.demoViews enumerateObjectsUsingBlock:^(SDDemoItemView *demoView, NSUInteger idx, BOOL *stop) {
        //        [self.view addSubview:demoView];
//        NSArray *arr = [self.cv visibleCells];
//        SelectedCell * cell = [arr objectAtIndex:a];
        [self.iv addSubview:demoView];
        //        SelectedCell * Xcell;
        //        NSArray *arr = [self.cv visibleCells];
        //        SelectedCell * cell = [arr firstObject];
        [demoView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.equalTo(_iv);
        }];
//        demoView.frame = CGRectMake(WIDTH/2-50, 200, 100, 100);
        
    }];
    _demoView = self.demoViews[0];
    _demoView.hidden = YES;
    _demoView.progressView.backgroundColor =[UIColor grayColor];
//    _demoView.hidden = YES;
    
}


- (void)createUI{

    
    self.iv = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, self.contentView.frame.size.width-0, self.contentView.frame.size.height)]
    ;
    
    
    [self.contentView addSubview:self.iv];
    self.iv.backgroundColor =[UIColor whiteColor];
    //self.iv.backgroundColor = [UIColor lightGrayColor];
    if (!_bgLabel) {
        _bgLabel = [[UILabel alloc] init];
        _bgLabel.backgroundColor = [UIColor colorWithRed:1 green:1 blue:1 alpha:0.5];
        [self.iv addSubview:_bgLabel];
        [_bgLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.equalTo(self.iv);
        }];
        
        _bgLabel.hidden = YES;
    }
    
    [self addProgressFrame];

}

@end
